<?php

// change the following paths if necessary
$yii=dirname(__FILE__).'/protected/libs/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';


$_SERVER ['DOCUMENT_ROOT'] = dirname(__FILE__).DIRECTORY_SEPARATOR;
require_once $_SERVER ['DOCUMENT_ROOT'] . '/protected/config/constants.php';

ini_set ( "display_errors", 1 );
error_reporting ( E_ALL );

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

//设置时区
date_default_timezone_set ( 'Asia/Shanghai' );

if(in_array( $_SERVER ['REMOTE_ADDR'], array('::1','127.0.0.1'))){
	$config = 'development';
}else{
	$config = 'production';
}
require_once($yii);
$config = PROTECTED_PATH . '/config/' . $config . '.php';

//开启Session
$session=new CHttpSession;
$session->open();


Yii::createWebApplication ( $config )->run ();
